Pinvon's Blog

所见, 所闻, 所思, 所想

Hyperledger BlockChain Explorer 部署

安装 postgresql

sudo apt install postgresql postgresql-contrib

下载代码

git clone https://github.com/hyperledger/blockchain-explorer.git

cd blockchain-explorer

数据库设置

sudo -u postgres psql

# 运行创建数据库的脚本
\i app/db/explorerpg.sql
\i app/db/updatepg.sql

# 查看数据库
\l

# 查看表
\d

启动 Fabric 网络

启动 first-network 的网络.

配置 hyperledger-explorer

另开一个终端, 进入 blockchain-explorer 目录.

修改 config.json, 将所有的 fabric-path 改成 fabric-samples 的所在路径.

运行

这一步我这边的环境报错了, 错误原因是说找不到 log4js 模块, 但查看 node_modules 可以看到, 已经安装了这个模块. 这个错误暂时未找到解决方案, 继续做后面的, 发现程序也可以运行.

cd blockchain-explorer/app/test
npm install
npm run test
cd blockchain-explorer
npm install
cd client
npm install
npm test -- -u --coverage
npm run build
cd blockchain-explorer
./start.sh  # 程序将在后台执行

# 查看日志
tail -f log.log  # 也可以直接用编辑器打开 log.log 查看

打开浏览器, 输入 localhost:8080 即可访问.

Comments

使用 Disqus 评论
comments powered by Disqus